﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using System.Diagnostics;

namespace SimpleGame
{
    public class BuildingEmpty : Building
    {
        public BuildingEmpty(Game1 game, Vector2 pos, int startTime = 0)
            :base(game,pos,startTime)
        {
            List<Texture2D> tmpImages = new List<Texture2D>();

            //TODO : imageBase + imageLen으로 로딩
            try
            {
                for (int i = 0; i <= 999; i++)
                {
                    string textureName = string.Format(@"Building\BuildingEmpty0_{0:d3}", i);
                    Console.WriteLine(textureName);
                    Texture2D texture = Content.Load<Texture2D>(textureName);
                    tmpImages.Add(texture);
                }
            }
            catch (ContentLoadException)
            {
            }

            Console.WriteLine(tmpImages.Count);

            Debug.Assert(tmpImages.Count > 0);

            this.images = tmpImages.ToArray();
            _setImageCollision();

            this.frame_gap = 100;

            this.name = "공백지";
            this.upgrade_rank = 1;
            this.month = 127;
            this.condition = 100;

            this.buildingAlign = new Vector2(0,0);
            this.pos = pos;

            this.time = startTime;
        }

        public BuildingEmpty(Game1 game, string imageBase, int frame_gap, int imageLen, string name, Vector2 buildingAlign, Vector2 pos, int startTime = 0)
            :base(game, imageBase, frame_gap, imageLen, name, buildingAlign, pos, startTime)
        {
            //TODO : 
            Debug.Assert("범용 코드는 구현 안했다에요"==null);
        }

        public override bool Update(GameTime gameTime, Vector2 basicPos, Vector2 mousePos)
        {

            bool value = base.Update(gameTime, basicPos, mousePos);
            if (!value)
            {
                return false;
            }

            _game.mainUI.openBuildingPage(this);
            Console.WriteLine(name);

            return true;
        }
    }
}
